<!-- Tin HOT -->
<?php
if (isset($newsHot) && !empty($newsHot)) :
?>
<div class="pad group">
	<div class="breaking-news clearfix pagewidth">
		<div class="slideshow-wrap">

			<h3 class="breaking-news-category">Tin Hot</h3>

			<ul data-speed="500" data-effect="slide" data-autoplay="4000" data-nextid="breaking-news-next" data-pauseid="breaking-news-play_pause" data-previd="breaking-news-prev" class="breaking-news-posts slideshow" >
				<?php
				foreach ($newsHot as $rows) :
				$linkDetail = $this->Html->url(
						array(
							'controller' => 'news',
							'action' => 'detail',
							'news_id' => $rows['News']['id'],
							'news_rewrite' => $rows['News']['new_rewrite'],
							'cat_rewrite' => $rows['Category']['cat_rewrite'],
							'ext' => 'html',
						)
					);
				?>
				<li>
					<a title="<?php echo $rows['News']['name'];?>" href="<?php echo $linkDetail;?>"><?php echo $rows['News']['name'];?></a>
				</li>
				<?php
				endforeach;
				?>
			</ul>

			<!--<div class="breaking-news-nav">
				<a class="breaking-news-prev" id="breaking-news-prev" href="#" style="display: inline;"></a>
				<a class="breaking-news-play_pause playing" id="breaking-news-play_pause" href="#" style="display: inline;"></a>
				<a class="breaking-news-next" id="breaking-news-next" href="#" style="display: inline;"></a>
			</div>-->

		</div>
		<!-- /.slideshow-wrap -->

	</div>
	<!-- end breaking -->
</div>
<?php
endif; //end if $newsHot
?>
<!-- Galler -->
<?php if(isset($allBanner['home']) && !empty($allBanner['home'])):?>
<div class="pad group">
	<h2>Ảnh hoạt động</h2>
</div>
<div class="pad group">
	<script type="text/javascript">
		// Check if first slider image is loaded, and load flexslider on document ready
		jQuery(document).ready(function(){
		 var firstImage = jQuery('#flexslider-featured').find('img').filter(':first'),
			checkforloaded = setInterval(function() {
				var image = firstImage.get(0);
				if (image.complete || image.readyState == 'complete' || image.readyState == 4) {
					clearInterval(checkforloaded);

					jQuery('#flexslider-featured').flexslider({
						animation: "slide",
						useCSS: false, // Fix iPad flickering issue
						slideshow: true,
						directionNav: false,
						controlNav: false,
						pauseOnHover: true,
						slideshowSpeed: 3000,
						animationSpeed: 400,
						smoothHeight: true,
						touch: false
					});

				}
			}, 20);
		});
	</script>
	<div id="flexslider-featured" class="featured flexslider">
		<?php echo $this->element('flexslider');?>

	</div>
</div>
<?php endif;?>
<!-- content -->
<?php
if(isset($home_category) && !empty($home_category)):
	foreach ($home_category as $cat):
		//link category
		$linkCategory = $this->Html->url(
				array(
						'controller' => 'categorys',
						'action' => 'index',
						'cat_id' => $cat['categories_multi']['id'],
						'cat_rewrite' => $cat['categories_multi']['cat_rewrite'],
						'cat_parent_rewrite' => $cat['categories_multi']['cat_parent_rewrite'],
				)
		);
?>
<div class="pad group">
	<div class="post-list group">
		<div class="lbl-category pad">
			<p><?php echo $cat['categories_multi']['cat_name']?></p>
		</div>
		<div class="group-content">
		<?php
		if(isset($cat['news_category']) && !empty($cat['news_category'])):
			$total = count($cat['news_category']);
			foreach ($cat['news_category'] as $key => $news):
				$key++;
				$linkDetail = $this->Html->url(
						array(
								'controller' => 'news',
								'action' => 'detail',
								'news_id' => $news['news']['id'],
								'news_rewrite' => $news['news']['new_rewrite'],
								'cat_rewrite' => $cat['categories_multi']['cat_rewrite'],
								'ext' => 'html',
						)
				);
			?>
			<?php if ($key % 2 == 1): ?>
			<div class="post-row" >
			<?php endif;//$key % 2 == 0?>
				<article class="<?php if ($key % 2 == 1): echo 'post-left';else : echo 'post-right';endif;?> post">
					<div class="post-inner post-hover">

						<div class="post-thumbnail">
							<a title="<?php echo $news['news']['name'];?>" href="<?php echo $linkDetail;?>">
								<?php echo $this->Html->image('/admin/uploads/' . $news['news']['new_picture'], array('alt' => $news['news']['name'], 'fullBase' => false, 'class' => 'attachment-thumb-medium wp-post-image', 'style' => 'height:150px;'));?>
							</a>
						</div><!--/.post-thumbnail-->

						<div class="post-meta group">
							<p class="post-category"><a rel="category tag" href="<?php echo $linkCategory;?>"><?php echo $cat['categories_multi']['cat_name']?></a></p>
							<p class="post-date"><?php echo date('d/m/Y', $news['news']['last_update']);?></p>
						</div><!--/.post-meta-->

						<h2 class="post-title">
							<a title="<?php echo $news['news']['name'];?>" rel="bookmark" href="<?php echo $linkDetail;?>"><?php echo $news['news']['name'];?></a>
						</h2><!--/.post-title-->

						<div class="entry excerpt">
							<p><?php echo $news['news']['brief'];?></p>
						</div><!--/.entry-->

					</div><!--/.post-inner-->
				</article>
			<?php if (($key % 2 == 0) || ($total == $key)): ?>
			</div>
			<div style="clear: both;"></div>
			<?php endif; //end if ($key % 2 == 1 || count($total) == $key)?>
		<?php
			endforeach; //end foreach $cat['news_category']
		endif; //end if $cat['news_category']
		?>
		</div>
	</div>
</div>
<?php
	endforeach;//end foreach $home_category
endif;//end if($home_category)
?>
<div class="pad group">
	<div class="post-list group">
		<?php echo $this->element('faq');?>
	</div>
</div>

<div class="pad group">
	<div class="post-list group">
		<?php echo $this->element('google_map');?>
	</div>
</div>
<nav class="pagination group">
</nav>